<!--
Date: 2025-08-13
Copyright (c) 2025 Industrial Software Feature Database
-->
<template>
  <el-form ref="formRef" :model="formInfo" inline size="small" label-width="100" class="form_class" :rules="rules">
    <el-form-item label="调度类型:" prop="schedulingType">
      <el-select style="width: 100%;" v-model="formInfo.schedulingType" clearable>
        <el-option label="周期性任务" :value="1"></el-option>
        <el-option label="外部触发任务" :value="2"></el-option>
      </el-select>
    </el-form-item>
    <!-- <el-form-item v-if="formInfo.schedulingType == '2'" label="依赖任务:" prop="schedulingCycle">
      <el-select style="width: 100%;" v-model="formInfo.schedulingCycle" clearable>
        <el-option label="oracle2doris测试" value="1"></el-option>
        <el-option label="mysql2mysql测试" value="2"></el-option>
        <el-option label="测试doris2mysql" value="3"></el-option>
        <el-option label="数据源同步接口" value="4"></el-option>
      </el-select>
    </el-form-item> -->
    <el-form-item label="调度周期:" prop="schedulingCycle">
      <el-input-number :min="0" controls-position="right" v-model="formInfo.schedulingCycle" clearable placeholder="调度周期"></el-input-number>
    </el-form-item>
    <el-form-item label="周期单位:" prop="cycleUnit">
      <el-radio-group v-model="formInfo.cycleUnit">
        <el-radio value="hour" size="small">时</el-radio>
        <el-radio value="day" size="small">天</el-radio>
      </el-radio-group>
    </el-form-item>
    
    <el-form-item label="调度时间:" prop="dispatchTime">
      <el-date-picker
        v-model="formInfo.dispatchTime"
        type="datetimerange"
        range-separator="至"
        start-placeholder="开始时间"
        end-placeholder="结束时间"
        size="small"
        format="YYYY-MM-DD HH:mm:ss"
        value-format="YYYY-MM-DD HH:mm:ss"
      />
    </el-form-item>
    <el-form-item label="生效日期:" prop="effectTime">
      <el-date-picker
        v-model="formInfo.effectTime"
        type="datetimerange"
        range-separator="至"
        start-placeholder="开始时间"
        end-placeholder="结束时间"
        size="small"
        format="YYYY-MM-DD HH:mm:ss"
        value-format="YYYY-MM-DD HH:mm:ss"
      />
    </el-form-item>
  </el-form>
</template>
        
<script name="TaskTargetConfig" setup>
const props = defineProps(['formInfo']);
const formRef = ref();
const formInfo = ref({
  schedulingType: '',
  schedulingCycle: '',
  cycleUnit: '',
  effectTime: [],
  dispatchTime: []
})
const options = ref([
  {
    label: '选项',
    value: 'code1'
  }
])
const rules = reactive({
  schedulingType: [
    { required: true, message: '请选择调度类型', trigger: 'blur' },
  ],
  schedulingCycle: [
    { required: true, message: '请输入调度周期', trigger: 'blur' },
  ],
  cycleUnit: [
    { required: true, message: '请输入周期单位', trigger: 'blur' },
  ],
  effectTime: [
    { required: true, message: '请选择生效日期', trigger: 'blur' },
  ],
  dispatchTime: [
    { required: true, message: '请选择调度时间', trigger: 'blur' },
  ],
})
onMounted(() => {
  // queryByCondition();
  props.formInfo && (formInfo.value = props.formInfo);
});
defineExpose({
  formInfo,
  formRef
});
</script>
<style scoped lang="scss">
:deep(.asterisk-left) {
  width: 100%;
}
</style>
